<template>
    <div id="fireManagement">
        <div style="height: 100%;">
            <div class="trees">
                <div class="tree_title">
                    <h3 class="tree_title_h3">机构列表</h3>
                </div>
                <div class="tree_body">
                    <Tree :data="baseData" @on-select-change="clickTree"></Tree>
                </div>
            </div>
            <div class="body_right">
                <div class="header-right">
                    灭火预案信息管理
                </div>
                <div class="btn_group">
                    <Select v-model="deviceSearch" clearable size="small" placeholder="所属装置" style="width: 15rem;">
                        <Option v-for="item in deviceData" :key="item.value" :value="item.value">{{item.value}}</Option>
                    </Select>
                    <Select v-model="levelSearch" clearable size="small" placeholder="事故级别" style="width: 15rem;">
                        <Option v-for="item in accidentLevelData" :key="item.value" :value="item.value">{{item.value}}
                        </Option>
                    </Select>
                    <Input v-model="materials_name" placeholder="预案名称" style="width: 15rem;" size="small"></Input>
                    <Button type="primary" icon="ios-search" size="small" @click="search">查询</Button>
                    <Button type="ghost" icon="ios-trash-outline" size="small" style="float:right;margin-right: 6px;"
                            @click="batchDele">批量删除
                    </Button>
                    <Button type="ghost" icon="ios-plus-empty" size="small" style="float:right;margin-right: 6px;"
                            @click="add">新增
                    </Button>
                </div>
                <div class="tableWidth">
                    <Table border :columns="columns7" :data="data6" stripe @on-selection-change="compileSelect"></Table>
                </div>
                <!--添加/修改-->
                <Modal v-model="modal5" title="灭火预案信息" width="500" :closable="false" :mask-closable="false">
                    <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="90"
                          style="margin-right: 20px">
                        <Form-item label="所属单位" prop="departmentName">
                            <p>{{formValidate.departmentName}}</p>
                        </Form-item>
                        <Form-item label="所属装置" prop="deviceName">
                            <Select v-model="formValidate.deviceName" clearable>
                                <Option v-for="item in deviceData" :key="item.value" :value="item.value">
                                    {{item.value}}
                                </Option>
                            </Select>
                        </Form-item>
                        <Form-item label="预案名称" prop="preplanName">
                            <Input v-model="formValidate.preplanName" placeholder="预案名称"/>
                        </Form-item>
                        <Form-item label="事故类型" prop="accidentTypeName">
                            <Select v-model="formValidate.accidentTypeName" clearable>
                                <Option v-for="item in accidentTypeData" :key="item.value" :value="item.value">
                                    {{item.value}}
                                </Option>
                            </Select>
                        </Form-item>
                        <Form-item label="事故级别" prop="levelName">
                            <Select v-model="formValidate.levelName" clearable>
                                <Option v-for="item in accidentLevelData" :key="item.value" :value="item.value">
                                    {{item.value}}
                                </Option>
                            </Select>
                        </Form-item>
                        <Form-item label="编写日期" prop="editTime">
                            <Date-picker type="date" placeholder="选择日期" v-model="formValidate.editTime"
                                         @on-change="showLoadTime"></Date-picker>
                        </Form-item>
                    </Form>
                    <div slot="footer">
                        <Button type="ghost" size="small" @click="cancelFrom">取消</Button>
                        <Button type="primary" size="small" @click="handleSubmit('formValidate')">提交</Button>
                    </div>
                    </Form>
                </Modal>
                <!-- 分页显示-->
                <div class="page_container">
                    <Page :current="currentPage" :total="totalCount" size="small" simple class="page_btn"
                          @on-change="changePage"></Page>
                    <P class="page_text">共{{totalCount}}条</P>
                </div>
                <!--消防预案说明-->
                <Modal v-model="firePlanDescription" title="灭火预案说明" width="500" :closable="false"
                       :mask-closable="false">
                    <Form  ref="formValidateExplain" :model="formValidateExplain" :rules="ruleValidateExplain" :label-width="80"
                          style="margin-right: 20px">
                        <Form-item label="处置对策" prop="countermeasure">
                            <Input v-model="formValidateExplain.countermeasure" type="textarea" :maxlength="maxlen"
                                   :autosize="{minRows: 4,maxRows: 5}" placeholder="请输入...(200字以内)"></Input>
                        </Form-item>
                        <Form-item label="注意事项" prop="attention">
                            <Input v-model="formValidateExplain.attention" type="textarea" :maxlength="maxlen" :autosize="{minRows: 4,maxRows: 5}"
                                   placeholder="请输入...(200字以内)"></Input>
                        </Form-item>
                    </Form>
                    <div slot="footer">
                        <Button type="ghost" size="small" @click="cancelFrom1">取消</Button>
                        <Button type="primary" size="small" @click="handleSubmit('formValidateExplain')">修改</Button>
                    </div>
                    </Form>
                </Modal>
                <!--消防预案内容附件-->
                <Modal v-model="annexToTheFirePlan" title="灭火预案内容附件" width="800" :closable="false"
                       :mask-closable="false">
                    <Form ref="formValidate1" :model="formValidate1" :rules="ruleValidate1" :label-width="90">
                        <!--上传文件-->
                        <Form-item label="上传文件">
                            <Upload :action="$nfs.uploadUrl" :data="$nfs.types.fire" accept="application/pdf"
                                    ref="uploadFile" :on-progress="disableConfirm" :on-error="handleError"
                                    :on-remove="removeUploadList" :default-file-list="uploadList" :format="['pdf']"
                                    :on-success="uploadFileSuccess">
                                <Button type="ghost" icon="ios-cloud-upload-outline">
                                    选择要上传文件的文件
                                </Button>
                            </Upload>
                        </Form-item>
                        <Form-item label="文件名称" prop="fileName" style="width:300px;">
                            <Input v-model="formValidate1.fileName" placeholder="文件名称"></Input>
                        </Form-item>
                        <Form-item label="文档说明" prop="fileDescription" style="">
                            <Input v-model="formValidate1.fileDescription" type="textarea"
                                   :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入...(200字以内)"></Input>
                        </Form-item>
                    </Form>
                    <div slot="footer" style="padding: 15px;">
                        <Button type="ghost" size="small" @click="cancelFrom2">取消</Button>
                        <Button type="primary" size="small" :loading="modal_loading"
                                @click="handleSubmit1('formValidate1')">提交
                        </Button>
                    </div>
                    </Form>
                    <div class="tableWidth" slot="footer">
                        <Table border :columns="fileUploadTable" :data="dataUpload" stripe
                               @on-selection-change="compileSelect1"></Table>
                    </div>
                    <div class="page_container" slot="footer">
                        <Page :current="currentPage1" :total="totalCount1" size="small" simple class="page_btn"
                              @on-change="changePage1"></Page>
                        <P class="page_text">共{{totalCount1}}条</P>
                    </div>
                </Modal>
            </div>
        </div>
    </div>
</template>
<script type="text/javascript">
    var ezjsUtil = Vue.ezjsUtil;
    var apiConstants = ezjsUtil.constants.api;
    export default {
        data() {
          const validateEditTime =(rule,value,callback) => {
            if(value === ''){
              callback(new Error('请选择日期'));
            }else {
              callback();
            }
          };
            return {
              departmentCode:CURRENT_LEADER.departmentCode,  //登录人员code值
              valueLen:'', //点击树获得的code值
                maxlen:500,
                // 上传----
                uploadList: [],
                modal_loading: false,
                uploadDataPath: [],//pdf上传path(token)的存放数组
                // -------
                baseData: [],
                materials_name: '', //按照物资名称搜索
                idss: "", //批量删除项（各项ids值-以字符串形式串联起来，逗号分割）
                fileIdss: "", //预览内容表id
                currentPage: 1, //灭火预案当前页
                totalCount: 0, //灭火预案总条数
                currentPage1: 1, //附件当前页
                totalCount1: 0, //附件总条数
                deviceSearch: '', //获取所属装置值
                levelSearch: '', //获取级别值
                accidentLevelData: [], //事故级别数据
                accidentTypeData: [], //事故类型数据
                deviceData: [], //装置数据
                fireReplan: '', //灭火预案表id
                search_code: '', //按照物资名称搜索
                /*  表头开始*/
                columns7: [{
                    type: 'selection',
                    width: 60,
                    align: 'center'
                },
                    {
                        title: '所属装置',
                        key: 'deviceName',
                        align: 'center'

                    },
                    {
                        title: '预案名称',
                        key: 'preplanName',
                        align: 'center'

                    },
                    {
                        title: '类型',
                        key: 'accidentTypeName',
                        align: 'center'

                    },
                    {
                        title: '级别',
                        key: 'levelName',
                        align: 'center'

                    },
                    {
                        title: '预案说明',
                        key: 'action',
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.showFirePlanDescription(params.row)
                                        }
                                    }
                                }, '编辑'),
                            ]);
                        }
                    },
                    {
                        title: '预案内容',
                        key: 'action',
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    on: {
                                        click: () => {
                                            this.fireReplan = params.row.id;
                                            this.formValidate1.firePreplanInformationId = this.fireReplan;
                                            this.preplanManagementFlipListForPreplanFile();
                                            this.annexToTheFirePlan = true;
                                        }
                                    }
                                }, '编辑'),
                            ]);
                        }
                    },
                    {
                        title: '操作',
                        key: 'action',
                        align: 'center',
                        width: 150,
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.carInfoEdit(params.row)
                                        }
                                    }
                                }, '修改'),
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'small'
                                    },
                                    on: {
                                        click: () => {
                                            this.carRemoveInfo(params.row.id)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    },
                ],
                fileUploadTable: [{
                    title: '文件名称',
                    key: 'fileName',
                    align: 'center'
                },
                    {
                        title: '文档说明',
                        key: 'fileDescription',
                        align: 'center'
                    },
                    {
                        title: '上传日期',
                        key: 'createTime',
                        align: 'center',
                        render: function (h, params) {
                            var newTime = new Date(params.row.createTime);
                            var Y = newTime.getFullYear();
                            var M = newTime.getMonth() + 1;
                            var D = newTime.getDate();
                            var H = newTime.getHours();
                            var m = newTime.getMinutes();
                            var s = newTime.getSeconds();
                            var time = Y + "-" + M + "-" + D + " " + H + ":" + m + ":" + s ;
                            return h('div', time);
                        }
                    },
                    {
                        title: '操作',
                        key: 'action',
                        align: 'center',
                        width: 150,
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.showPdf(params.index)
                                        }
                                    }
                                }, '预览'),
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'small'
                                    },
                                    on: {
                                        click: () => {
                                            this.carRemoveInfo1(params.row.id);

                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    },
                ],
                /*表头结束*/
                /* 表格数据显示区域*/
                data6: [],
                /* 文件上传接受数据*/
                dataUpload: [],
                /* 全局变量*/
                modal5: false,
                firePlanDescription: false,
                annexToTheFirePlan: false,
                /* 主表校验*/
                formValidate: { //表单验证
                    id: '', //1
                    departmentCode: '',
                    departmentName: '',
                    departmentNameCopy: '',
                    deviceNameId: '',
                    accidentTypeId: '',
                    levelId: '',
                    deviceName: '', //2    所属装置
                    preplanName: '', //3    预案名称
                    accidentTypeName: '', //5    事故类型
                    levelName: '', //7    事故级别
                    editTime: '', //8    编写日期
                    countermeasure: '', //9    处置对策
                    attention: '', //10    注意事项
                },
                ruleValidate: {
                    departmentName: [{
                        required: true, whitespace: true, message: '所属单位不能为空', trigger: 'blur'
                    }],
                    deviceName: [{
                        required: true, whitespace: true, message: '所属装置不能为空', trigger: 'change'
                    }],
                    preplanName: [{
                        required: true, whitespace: true, message: '预案名称不能为空', trigger: 'blur'
                    }],
                    accidentTypeName: [{
                        required: true, message: '事故类型不能为空', trigger: 'change'
                    }],
                    levelName: [{
                        required: true, message: '事故级别不能为空', trigger: 'change'
                    }],
                    editTime: [{
                        required: true, validator:validateEditTime, trigger: 'change'
                    }],
                },
                formValidateExplain:{
                    countermeasure:'',
                    attention:'',
                },
                ruleValidateExplain:{
                    countermeasure: [
                        { type: 'string', max: 200, message: '内容过长，最多200字', trigger: 'blur' }
                    ],
                    attention: [
                        { type: 'string', max: 200, message: '内容过长，最多200字', trigger: 'blur' }
                    ],
                },
                /* 预案内容校验*/
                formValidate1: { //表单验证
                    id: '', //1
                    fileName: '', //12   文件名
                    fileDescription: '', //3    文档说明
                    filePath: '', //5    文件路径
                    firePreplanInformationId: '', //6   灭火预案主表id

                },
                ruleValidate1: {
                    fileName: [
                        {required: true, message: '文件名称不能为空', trigger: 'blur'}
                    ],
                    fileDescription: [
                        { type: 'string', max: 200, message: '内容过长，最多200字', trigger: 'blur' }
                    ],
                },
            }
        },
        /* 在实例初始化之后，数据观测(data observer) 和 event/watcher 事件配置之前被调用。*/
        created() {
            this.dictionary_flipList_accidentLevel();
            this.dictionary_flipList_accidentType();
            this.dictionary_flipList();
            this.preplanManagementFlipListForPreplanInformation();
            this.preplanManagementFlipListForPreplanFile();
            this.organization_flipList();
        },
        /*在挂载开始之前被调用：相关的 render 函数首次被调用。*/
        mounted: function () {

        },
        methods: {
            //上传过程中
            disableConfirm() {
                var _this = this;
                _this.modal_loading = true;
            },
            //上传失败
            handleError(error, file) {
                this.$Message.error('上传失败!');
                this.modal_loading = false;
            },
            //移除文件列表
            removeUploadList() {
                this.uploadList = [];

            },
            //上传文件（视屏，文本）成功
            uploadFileSuccess(res, file) {
                var _this = this;
                _this.modal_loading = false;
                //删除之前传的内容
                if (_this.$refs.uploadFile.fileList.length > 1) {
                    _this.$refs.uploadFile.fileList.splice(0, 1);
                }
                // _this.uploadDataPath.push(res.data.token);
                _this.formValidate1.filePath = res.data.token;

            },
            uploadList() {

            },
          add() {
            if (this.formValidate.departmentName != '') {
              this.formValidate.id = "";
              this.modal5 = true;
            }else if( this.valueLen <= 0){
              this.$Modal.info({
                content: '请在机构列表选择机构单位！'
              });
            }else{
              this.$Message.error('权限不够，无法新增，请联系管理员！');
            }
          },
          clickTree(value) {
            this.valueLen = value.length;
            if (this.valueLen > 0 && this.departmentCode<=value[0].code) {
              this.formValidate.departmentCode = value[0].code;
              this.formValidate.departmentName = value[0].fullTitle;
              this.formValidate.departmentNameCopy = value[0].fullTitle;
              this.search_code=value[0].code;
            }else {
              this.formValidate.departmentCode = '';
              this.formValidate.departmentName = '';
              this.formValidate.departmentNameCopy = '';
              this.search_code= '';
            }
            this.search();
          },
            /*上传附件增删预览部分开始*/
            preplanManagementFlipListForPreplanFile() { //显示与查询接口
                var _this = this;
                ezjsUtil.request(apiConstants.preplanManagement_flipListForPreplanFile, {
                        id: _this.fireReplan,
                        pageNo: _this.currentPage1,
                    },
                    function (err, data) {
                        if (err) {
                            return;
                        }
                        _this.dataUpload = data.listInfo;
                        _this.totalCount1 = data.flipInfo.totalCount;
                    }
                )
            },
            preplanManagement_editForPreplanFile() { //上传附件新增
                var _this = this;
                ezjsUtil.request(apiConstants.preplanManagement_editForPreplanFile, {
                        id: _this.formValidate1.id,
                        firePreplanInformationId: _this.formValidate1.firePreplanInformationId,
                        filePath: _this.formValidate1.filePath,
                        fileDescription: _this.formValidate1.fileDescription,
                        fileName: _this.formValidate1.fileName,
                    },
                    function (err, data) {
                        if (err) {
                            return;
                        }
                        _this.preplanManagementFlipListForPreplanFile();
                        _this.formValidate1.filePath='';
                        _this.uploadList = [];
                    }
                )
            },
            handleSubmit1(name) { //表单验证
                if(this.formValidate1.filePath){
                    this.$refs[name].validate((valid) => {
                        if (valid) {
                            this.preplanManagement_editForPreplanFile(); //调用编辑接口
                            this.$Message.success('提交成功!');
                            /*  this.annexToTheFirePlan=false;         //关闭模态框*/
                            this.handleReset('formValidate1');
                        } else {
                            this.$Message.error('表单验证失败!');
                        }
                    })
                }else {
                    this.$Modal.info({
                        content: '请选择需要上传的文件！'
                    });
                }
            },
            /* 预案内容删除数据部分starting*/
            compileSelect1(selection, row) { //表格选择
                var ids = "";
                for (var i = 0; i < selection.length; i++) {
                    ids = selection[i].id + "," + ids; //逗号分隔
                }
                this.fileIdss = ids;
            },
            carRemoveInfo1(value) { //单个删除
                this.fileIdss = value;
                this.preplanManagement_removeForPreplanFileByIds();
            },
            preplanManagement_removeForPreplanFileByIds() { //删除
                var _this = this;
                ezjsUtil.request(apiConstants.preplanManagement_removeForPreplanFileByIds, {
                        ids: _this.fileIdss //将选中项的的ids给ids（字符串形式，逗号分隔）
                    },
                    function (err, data) {
                        if (err) {
                            return;
                        }
                        _this.preplanManagementFlipListForPreplanFile();
                    },
                )
            },
            changePage1(page) { //分页展示
                this.currentPage1 = page;
                this.preplanManagementFlipListForPreplanFile();
            },
            //日期格式转换
            dateformatting(dateval) {
                var newTime = new Date(dateval);
                var yyyy = newTime.getFullYear();
                var MM = newTime.getMonth() + 1;
                var dd = newTime.getDate();
                var hh = newTime.getHours();
                var mm = newTime.getMinutes();
                var ss = newTime.getSeconds();
                var time = yyyy + "-" + MM + "-" +dd;
                return time
            },
            carInfoEdit(value) { //修改
                this.formValidate.id = value.id;
                this.formValidate.departmentCode = value.departmentCode;
                this.formValidate.departmentName = value.departmentName;
                this.formValidate.deviceNameId = value.deviceNameId;
                this.formValidate.accidentTypeId = value.accidentTypeId;
                this.formValidate.levelId = value.levelId;
                this.formValidate.deviceName = value.deviceName;
                this.formValidate.preplanName = value.preplanName;
                this.formValidate.accidentTypeName = value.accidentTypeName;
                this.formValidate.levelName = value.levelName;
                this.formValidate.editTime = this.dateformatting(value.editTime);
                this.modal5 = true;
            },
            showLoadTime(data) { //改变时，将日期值赋值
                this.formValidate.editTime = data;
            },
            cancelFrom() { //单击取消重置并关闭模态框-主页面
                this.modal5 = false;
                this.handleReset('formValidate');
                this.formValidate.departmentName=this.formValidate.departmentNameCopy;
                this.formValidate.departmentCode =this.search_code;
            },
            cancelFrom1() { //单击取消重置并关闭模态框-预案说明
                this.firePlanDescription = false;
                this.handleReset('formValidate');
            },
            cancelFrom2() { //单击取消重置并关闭模态框-预案内容
                this.formValidate1.id='';
                this.annexToTheFirePlan = false;
                this.handleReset('formValidate1');
                this.removeUploadList();
                this.currentPage1 = 1;

            },
            changePage(page) { //分页展示
                this.currentPage = page;
                this.preplanManagementFlipListForPreplanInformation();
            },
            showFirePlanDescription(value) {
                this.formValidate.id = value.id;
                this.formValidateExplain.countermeasure = value.countermeasure;
                this.formValidateExplain.attention = value.attention;
                this.firePlanDescription = true;
            },
            preplanManagementFlipListForPreplanInformation() { //显示与查询接口
                var _this = this;
                ezjsUtil.request(apiConstants.preplanManagement_flipListForPreplanInformation, {
                        departmentCode: _this.formValidate.departmentCode,
                        deviceName: _this.deviceSearch,
                        levelName: _this.levelSearch,
                        preplanName: _this.materials_name,
                        pageNo: _this.currentPage
                    },
                    function (err, data) {
                        if (err) {
                            return;
                        }
                        _this.data6 = data.listInfo;
                        _this.totalCount = data.flipInfo.totalCount;
                    }
                )
            },

            preplanManagementEditPreplanInformation() { //新增
                var _this = this;
                ezjsUtil.request(apiConstants.preplanManagement_editPreplanInformation, {
                        id: _this.formValidate.id,
                        departmentCode: _this.formValidate.departmentCode,
                        departmentName: _this.formValidate.departmentName,
                        deviceNameId: _this.formValidate.deviceNameId,
                        deviceName: _this.formValidate.deviceName,
                        preplanName: _this.formValidate.preplanName,
                        accidentTypeId: _this.formValidate.accidentTypeId,
                        accidentTypeName: _this.formValidate.accidentTypeName,
                        levelId: _this.formValidate.levelId,
                        levelName: _this.formValidate.levelName,
                        countermeasure: _this.formValidateExplain.countermeasure,
                        attention: _this.formValidateExplain.attention,
                        editTime: _this.formValidate.editTime,
                    },
                    function (err, data) {
                        if (err) {
                            return;
                        }
                        _this.formValidate.departmentName="";
                        _this.formValidate.departmentCode="";
                        _this.formValidate.departmentNameCopy="";
                        _this.formValidate.departmentCodeCopyCopy="";
                        _this.preplanManagementFlipListForPreplanInformation();
                        _this.valueLen = '';
                        _this.organization_flipList();


                    }
                )
            },
            /* 删除数据部分starting*/
            compileSelect(selection, row) { //表格选择
                var ids = "";
                for (var i = 0; i < selection.length; i++) {
                    ids = selection[i].id + "," + ids; //逗号分隔
                }
                this.idss = ids;
            },
            carRemoveInfo(value) { //单个删除
                this.idss = value;
                this.preplanManagementRemoveForPreplanInformationByIds();
            },
            batchDele() { //批量删除
                if(this.idss){
                    this.preplanManagementRemoveForPreplanInformationByIds(); //调用删除接口
                }else {
                    this.$Message.error('请选择删除项!');
                }
            },
            preplanManagementRemoveForPreplanInformationByIds() { //删除
                var _this = this;
                ezjsUtil.request(apiConstants.preplanManagement_removeForPreplanInformationByIds, {

                        ids: _this.idss //将选中项的的ids给ids（字符串形式，逗号分隔）
                    },
                    function (err, data) {
                        if (err) {
                            return;
                        }
                        _this.idss='';
                        _this.preplanManagementFlipListForPreplanInformation();
                    },
                )
            },
            search() { //查询
                this.currentPage=1;
                this.preplanManagementFlipListForPreplanInformation(); //调用显示接口
            },
            handleSubmit(name) { //表单验证
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        this.preplanManagementEditPreplanInformation(); //调用编辑接口
                        this.$Message.success('提交成功!');
                        this.modal5 = false; //关闭模态框
                        this.firePlanDescription=false;
                        this.handleReset('formValidate');
                    } else {
                        this.$Message.error('表单验证失败!');
                    }
                })
            },
            handleReset(name) { //重置
                this.$refs[name].resetFields();
            },

            handleUpSuccess(res, file) {
                var _this = this;
            },
            handleUpError(res, file) {
            },

            /*组织机构数*/
            organization_flipList() { //显示 查询
                var _this = this;
                ezjsUtil.request(apiConstants.organization_flipList, {},
                    function (err, data) {
                        if (err) {
                            return;
                        }
                        _this.baseData = data;
                        _this.baseData[0].expand = true;
                    }
                )
            },

            /*字典数据相关接口*/
            dictionary_flipList() { //显示 查询
                var _this = this;
                ezjsUtil.request(apiConstants.dictionary_flipList, {
                        key: "device",
                    },
                    function (err, data) {
                        if (err) {
                            return;
                        }
                        _this.deviceData = data;
                    }
                )
            },
            dictionary_flipList_accidentType() { //显示 查询
                var _this = this;
                ezjsUtil.request(apiConstants.dictionary_flipList, {
                        key: "accidentType",
                    },
                    function (err, data) {
                        if (err) {
                            return;
                        }
                        _this.accidentTypeData = data;
                    }
                )
            },
            dictionary_flipList_accidentLevel() { //显示 查询
                var _this = this;
                ezjsUtil.request(apiConstants.dictionary_flipList, {
                        key: "accidentLevel",
                    },
                    function (err, data) {
                        if (err) {
                            return;
                        }
                        _this.accidentLevelData = data;
                    }
                )
            },
            // 预览
            showPdf(index) {
                var _this = this, _index = index;
                var url = ezjsUtil.nfsUtil.getFileUrl(_this.dataUpload[_index].filePath);
                window.open(url);
            },
        }
    }
</script>
<style lang="less" scoped>
    #fireManagement {
        height: 100%;
        overflow: auto;
        padding: 15px;

    .trees {
        width: 260px;
        height: 100%;
        padding-bottom: 30px;
        float: left;
        border: 1px solid #d3d8e0;
        overflow: auto;

    .tree_title {
        height: 40px;
        border-bottom: 1px solid #d3d8e0;

    .tree_title_h3 {
        line-height: 40px;
        text-align: center;
        font-size: 14px;
        color: #6e6d6d;
    }

    }
    .tree_body {
        padding: 10px;
    }

    }
    .body_right {
        margin-left: 280px;
        height: 100%;
        overflow: auto;

    .header-right {
        height: 40px;
        border-bottom: 1px solid #d3d8e0;
        font-size: 14px;
        color: #657180;
        line-height: 40px;
        font-family: '微软雅黑';
    }

    .btn_group {
        width: 100%;
        padding: 1.5rem 0;
    }

    .tableWidth {
        width: 100%;
    }

    }
    }

    .page_container {
        height: 30px;
        margin-top: 20px;

    .page_btn {
        float: right;
    }

    .page_text {
        float: right;
        line-height: 26px;
    }

    }
</style>
